import { ActionTypes, AssetImages, HttpAPI } from '../constants'
import { AxiosUtil } from '../utils'
import base from './base'
const upload = 'upload'
const updateUserHeadImage = 'user/image/upload'
const updatePetHeadImage = 'pet/image/upload'
export default {
    // getVideoList: function* (payload) {
    //     const { response, error } = yield AxiosUtil.get(homeList);
    //     console.log('getVideoList', response, error);
    //     yield base.after(response, error, ActionTypes.API_GET_VIDEO_LIST_SUCCESS)
    // }
    fetchUploadVideo: function * (payload) {
        const { data, callBack = null } = payload;
        const { response, error } = yield AxiosUtil.post(upload, data)
        yield base.after(response, error, ActionTypes.API_UPLOAD_VIDEO_SUCCESS)
        callBack && callBack(response, error)
    },
    fetchUploadHeadImage: function * (payload) {
        const { data, callBack = null } = payload;
        const { response, error } = yield AxiosUtil.post(updateUserHeadImage, data)
        yield base.after(response, error, ActionTypes.API_CHANGE_HEAD_IMAGE_SUCCESS)
        callBack && callBack(response, error)
    },
    fetchUploadPetImage: function * (payload) {
        const { data, callBack = null } = payload
        const { response, error } = yield AxiosUtil.post(updatePetHeadImage, data)
        yield base.after(response, error, ActionTypes.API_CHANGE_PET_IMAGE_SUCCESS)
        callBack && callBack(response, error)
    }
}